home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / Appearance SDK 1.0.4 / Appearance Sample Code / Source / BaseDialog.cp < prev    next >
Encoding:
Text File  |  1999-07-16  |  1.9 KB  |  114 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        BaseDialog.cp
  3.  
  4.     Contains:    Base class for a dialog.
  5.  
  6.     Version:    Appearance 1.0 SDK
  7.  
  8.     Copyright:    © 1997 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     File Ownership:
  11.  
  12.         DRI:                Edward Voas
  13.  
  14.         Other Contact:        7 of 9, Borg Collective
  15.  
  16.         Technology:            OS Technologies Group
  17.  
  18.     Writers:
  19.  
  20.         (edv)    Ed Voas
  21.  
  22.     Change History (most recent first):
  23.  
  24.          <1>     9/11/97    edv        First checked in.
  25. */
  26.  
  27. #include <Dialogs.h>
  28. #include "BaseDialog.h"
  29.  
  30. BaseDialog::BaseDialog()
  31. {
  32. }
  33.  
  34. BaseDialog::BaseDialog( SInt16 resID )
  35. {
  36.     fWindow = GetNewDialog( resID, NULL, (WindowPtr)-1L );
  37.     if ( fWindow )
  38.     {
  39.         ((WindowPeek)fWindow)->windowKind = 2000;
  40.         SetWRefCon( fWindow, (long)this );
  41.     }
  42. }
  43.  
  44. BaseDialog::~BaseDialog()
  45. {
  46.     if ( fWindow )
  47.     {
  48.         DisposeDialog( fWindow );
  49.         fWindow = nil;
  50.     }
  51. }
  52.  
  53. void
  54. BaseDialog::Update( EventRecord& event )
  55. {
  56.     DialogPtr        dialog;
  57.     SInt16            itemHit;
  58.  
  59.     ((WindowPeek)fWindow)->windowKind = dialogKind;
  60.     DialogSelect( &event, &dialog, &itemHit );
  61.     ((WindowPeek)fWindow)->windowKind = 2000;
  62. }
  63.  
  64. void
  65. BaseDialog::Activate( EventRecord& event )
  66. {
  67.     DialogPtr        dialog;
  68.     SInt16            itemHit;
  69.     
  70.     ((WindowPeek)fWindow)->windowKind = dialogKind;
  71.     DialogSelect( &event, &dialog, &itemHit );
  72.     ((WindowPeek)fWindow)->windowKind = 2000;
  73. }
  74.  
  75. void
  76. BaseDialog::Deactivate( EventRecord& event )
  77. {
  78.     DialogPtr        dialog;
  79.     SInt16            itemHit;
  80.     
  81.     ((WindowPeek)fWindow)->windowKind = dialogKind;
  82.     DialogSelect( &event, &dialog, &itemHit );
  83.     ((WindowPeek)fWindow)->windowKind = 2000;
  84. }
  85.  
  86. void
  87. BaseDialog::HandleClick( EventRecord& event )
  88. {
  89.     DialogRef        dialog;
  90.     SInt16            itemHit;
  91.     
  92.     if ( DialogSelect( &event, &dialog, &itemHit ) )
  93.     {
  94.         HandleItemHit( itemHit );
  95.     }
  96. }
  97.  
  98. void
  99. BaseDialog::HandleKeyDown( EventRecord& event )
  100. {
  101.     DialogPtr        dialog;
  102.     SInt16            itemHit;
  103.     
  104.     ((WindowPeek)fWindow)->windowKind = dialogKind;
  105.     DialogSelect( &event, &dialog, &itemHit );
  106.     ((WindowPeek)fWindow)->windowKind = 2000;
  107. }
  108.  
  109.  
  110. void
  111. BaseDialog::HandleItemHit( short /*itemHit*/ )
  112. {
  113. }
  114.